#include "PlanetariTextProcess.h"
#include "RenderManager.h"
#include "Math\Matrix44.h"
#include "Font\FontManager.h"

//CVideogameProcess::CVideogameProcess()
//{
//}


CPlanetariTextProcess::~CPlanetariTextProcess()
{
	DeInit();
}

void CPlanetariTextProcess::Init()
{
}

void CPlanetariTextProcess::DeInit()
{
}

void CPlanetariTextProcess::Update(float dt)
{
	m_fAngle += 0.001f;
	m_fAngleMoon -= 0.02f;
}

void CPlanetariTextProcess::RenderScene(CRenderManager* RM)
{
	//Mat44f l_matrix;
	//l_matrix.SetIdentity();
	//RM->SetTransform(l_matrix);
	//RM->Debug_DrawAxis(3);
	////RM->Debug_DrawGrid(2, 4, colWHITE);
	//RM->Debug_DrawGrid(4, 3, 4, colWHITE);
	////RM->Debug_DrawCube(1, colWHITE);

	//l_matrix.SetIdentity();
	//l_matrix.Translate(Vect3f(0, 3, 0));
	//RM->SetTransform(l_matrix);
	//RM->Debug_DrawSphere(0.5, 10, colWHITE);


	//l_matrix.SetIdentity();
	//l_matrix.SetFromAngleY(45*e2PIf/180);
	//RM->SetTransform(l_matrix);
	//RM->Debug_DrawCube(1, colWHITE);


	Mat44f l_matrix, rotate, translate;

	l_matrix.SetIdentity();
	RM->SetTransform(l_matrix);
	RM->Debug_DrawAxis(3);
	RM->Debug_DrawSphere(1.5, 20, colYELLOW);

	l_matrix.SetIdentity();
	rotate.SetIdentity();
	translate.SetIdentity();

	rotate.SetFromAngleY(m_fAngle);
	translate.Translate(Vect3f(0, 0, 5));
	l_matrix = rotate * translate * rotate;
	RM->SetTransform(l_matrix);
	RM->Debug_DrawSphere(0.7f, 20, colGREEN); //Terra rotant sobre si mateixa

	l_matrix.SetIdentity();
	rotate.SetIdentity();
	translate.SetIdentity();

	rotate.SetFromAngleY(m_fAngle);
	l_matrix = rotate;

	translate.Translate(Vect3f(0, 0, 5));
	l_matrix = l_matrix * translate;

	rotate.SetIdentity();
	rotate.SetFromAngleY(m_fAngleMoon);
	l_matrix =l_matrix * rotate;

	translate.SetIdentity();
	translate.Translate(Vect3f(0, 0, 1.5));
	l_matrix = l_matrix * translate;

	RM->SetTransform(l_matrix);
	RM->Debug_DrawSphere(0.3f, 10, colGREY);
}

void CPlanetariTextProcess::RenderScene2D(CRenderManager* RM, CFontManager* FM)
{
	//int inc = FM->DrawDefaultText(0, 0, colWHITE, "HiWorld123");
	//int32 l_iFontID = FM->GetTTF_Id("Deco");
	//inc += FM->DrawTextA(0, inc, colWHITE, l_iFontID, "abcWW");
	//l_iFontID = FM->GetTTF_Id("futurama");
	//inc += FM->DrawTextA(0, inc, colWHITE, l_iFontID, "Furutama");
	//inc += FM->DrawLiteral(0, inc, "HiWorld");
	//inc += FM->DrawLiteral(0, inc, "textoCinematic");
}